package com.itheima.weiyunsuan;

public class DateChange2 {
    /*
        需求：已知两个整数变量a = 10,b = 20,使用程序实现这两个变量的数据交换，最终输出a = 20 , b = 10;

        不允许使用三方变量
     */
    public static void main(String[] args) {
        int a = 10;
        int b = 20;
        a = a ^ b;      //a = 10 ^ 20
        b = a ^ b;      //b = 10 ^ 20 ^ 20
        a = a ^ b;      //a = 10 ^ 20 ^ 10
        System.out.println("a=" + a);
        System.out.println("b=" + b);
    }
}
